//
//  HYReadControl.m
//  XPlayer
//
//  Created by 张水 on 2023/11/19.
//

#import "HYReadControl.h"

@interface HYReadControl()
@property (nonatomic, strong) UIImageView *iconImageView;
@property (nonatomic, strong) UILabel *titleLabel;
@end

@implementation HYReadControl

- (instancetype)init
{
    if (self = [super init]) {
        [self configUI];
    }
    return self;
}
- (void)configUI
{
    [self addSubview:self.iconImageView];
    [self addSubview:self.titleLabel];
    [self.iconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.mas_centerX);
        make.top.equalTo(self).offset(20);
        make.width.height.equalTo(@25);
    }];
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.mas_centerX);
        make.top.equalTo(self.iconImageView.mas_bottom).offset(5);
    }];
}
- (void)setImageName:(NSString *)imageName
{
    _iconImageView.image = [UIImage imageNamed:imageName];
}
- (void)setTitleString:(NSString *)titleString
{
    _titleLabel.text = titleString;
}

- (UIImageView *)iconImageView
{
    if (_iconImageView == nil) {
        _iconImageView = [[UIImageView alloc]init];
    }
    return _iconImageView;
}
- (UILabel *)titleLabel
{
    if (_titleLabel == nil) {
        _titleLabel = [[UILabel alloc]init];
        _titleLabel.textColor = [UIColor whiteColor];
        _titleLabel.font = kIsIPad?FONT_SIZE(14):FONT_SIZE(12);
    }
    return _titleLabel;
}
@end
